﻿using System;
using Nuwanda.Common;

namespace Nuwanda.TfsSpotlight.Shell.Services
{
    /// <summary>Stores information about remote version</summary>
    [Author("Bartłomiej Legiędź")]
    internal class VersionInfo
    {
        /// <summary>Version number</summary>
        public Version Version { get; private set; }

        /// <summary>The address to the package containing updated files</summary>
        public string Package { get; private set; }

        /// <summary>A address to the version info</summary>
        public string Reference { get; private set; }

        public VersionInfo(Version version) : this(version, String.Empty, String.Empty) {}

        public VersionInfo(string version, string package, string reference) 
            : this(new Version(version), package, reference) {}

        private VersionInfo(Version version, string package, string reference)
        {
            this.Version = version;
            this.Package = package;
            this.Reference = reference;
        }

        public static bool operator >(VersionInfo left, VersionInfo right)
        {
            return left.Version > right.Version;
        }

        public static bool operator <(VersionInfo left, VersionInfo right)
        {
            return left.Version < right.Version;
        }
    }
}